package com.green.card.adapter;


import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;


/**
 * Created by admin on 2018/1/25.
 * 每个生成的Fragment都会保存到内存里面，适用于那些相对静态、数量也比较少的情况。
 */

public class MyFragmentAdapter extends FragmentPagerAdapter {
    private List<Fragment>    fragmentList;

    public MyFragmentAdapter(FragmentManager fm, List<Fragment> list) {
        super(fm);
        fragmentList = list;
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }
}
